home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
keypres2.zip
/
KEYPRESS.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-11-14
|
2KB
|
74 lines
;keypress.com, disassembled via DASM and commented
; by David Kirschbaum
; Toad Hall
;(Why won't people distribute source for simple things like this? Sigh ...)
;
PAGE ,132
CodeSeg SEGMENT BYTE PUBLIC 'code'
ASSUME CS:CodeSeg
ASSUME SS:CodeSeg
ASSUME DS:CodeSeg
;notice no ORG so we can access the FCB
H00000 DB 128 DUP(?) ;FCB beginning
CmdLine DB 128 DUP(?) ;DOS FCB command line
KeyPress PROC FAR
ASSUME ES:CodeSeg
Start:
MOV AH,07H
INT 21H
CMP AL,00H
JNE GotKey
MOV AH,07H
INT 21H
XOR AL,AL ;Return value 0
MOV AH,4CH ;Terminate process
INT 21H ;Terminate
;check out possible key inputs
GotKey:
CMP AL,'A'
JC Skp11C ;below
CMP AL,'Z'
JNBE Skp11C ;upper case
ADD AL,20H ;lowercase it
Skp11C:
MOV AH,AL
MOV DH,' '
XOR DL,DL
XOR CH,CH ;clear msb
MOV CL,CmdLine ;cmd line length
JCXZ Exit14C ;no command line
MOV SI,0081H ;let's check out the whole thing
Lup12D:
LODSB ;snarf cmd line char
CMP AL,DH ;space?
JNE ChkKey ;nope, go process it
LOOP Lup12D ;gobble spaces
XOR DL,DL ;failed, return a 0
JMP SHORT Exit14C ; and exit
ChkKey:
CMP AL,'A' ;see if alphabetic char
JC Skp142 ; must be a digit
CMP AL,'Z' ;
JNBE Skp142 ; ok, a letter
ADD AL,20H ;change to uppercase char
Skp142:
INC DL ;bump return value
CMP AL,AH
JE Exit14C ;done
LOOP Lup12D ;check them all
XOR DL,DL ;no legal entry, return a 0
Exit14C:
MOV AL,DL ;return val in AL
MOV AH,4CH ;terminate proces
INT 21H
KeyPress ENDP
; DB 14 DUP(?) ;some sort of garbage
CodeSeg ENDS
END KeyPress